home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsIBinaryInputStream.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  9KB  |  275 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIBinaryInputStream.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIBinaryInputStream_h__
  6. #define __gen_nsIBinaryInputStream_h__
  7.  
  8.  
  9. #ifndef __gen_nsIInputStream_h__
  10. #include "nsIInputStream.h"
  11. #endif
  12.  
  13. #ifndef __gen_nsrootidl_h__
  14. #include "nsrootidl.h"
  15. #endif
  16.  
  17. /* For IDL files that don't want to include root IDL files. */
  18. #ifndef NS_NO_VTABLE
  19. #define NS_NO_VTABLE
  20. #endif
  21.  
  22. /* starting interface:    nsIBinaryInputStream */
  23. #define NS_IBINARYINPUTSTREAM_IID_STR "7b456cb0-8772-11d3-90cf-0040056a906e"
  24.  
  25. #define NS_IBINARYINPUTSTREAM_IID \
  26.   {0x7b456cb0, 0x8772, 0x11d3, \
  27.     { 0x90, 0xcf, 0x00, 0x40, 0x05, 0x6a, 0x90, 0x6e }}
  28.  
  29. /**
  30.  * This interface allows consumption of primitive data types from a "binary
  31.  * stream" containing untagged, big-endian binary data, i.e. as produced by an
  32.  * implementation of nsIBinaryOutputStream.  This might be used, for example,
  33.  * to implement network protocols or to read from architecture-neutral disk
  34.  * files, i.e. ones that can be read and written by both big-endian and
  35.  * little-endian platforms.
  36.  *
  37.  * @See nsIBinaryOutputStream
  38.  */
  39. class NS_NO_VTABLE nsIBinaryInputStream : public nsIInputStream {
  40.  public: 
  41.  
  42.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IBINARYINPUTSTREAM_IID)
  43.  
  44.   /* void setInputStream (in nsIInputStream aInputStream); */
  45.   NS_IMETHOD SetInputStream(nsIInputStream *aInputStream) = 0;
  46.  
  47.   /* PRBool readBoolean (); */
  48.   NS_IMETHOD ReadBoolean(PRBool *_retval) = 0;
  49.  
  50.   /* PRUint8 read8 (); */
  51.   NS_IMETHOD Read8(PRUint8 *_retval) = 0;
  52.  
  53.   /* PRUint16 read16 (); */
  54.   NS_IMETHOD Read16(PRUint16 *_retval) = 0;
  55.  
  56.   /* PRUint32 read32 (); */
  57.   NS_IMETHOD Read32(PRUint32 *_retval) = 0;
  58.  
  59.   /* PRUint64 read64 (); */
  60.   NS_IMETHOD Read64(PRUint64 *_retval) = 0;
  61.  
  62.   /* float readFloat (); */
  63.   NS_IMETHOD ReadFloat(float *_retval) = 0;
  64.  
  65.   /* double readDouble (); */
  66.   NS_IMETHOD ReadDouble(double *_retval) = 0;
  67.  
  68.   /**
  69.      * Read a NUL-terminated 8-bit char* string from a binary stream.
  70.      */
  71.   /* ACString readCString (); */
  72.   NS_IMETHOD ReadCString(nsACString & _retval) = 0;
  73.  
  74.   /**
  75.      * Read a NUL-terminated 16-bit PRUnichar* string from a binary stream.
  76.      */
  77.   /* AString readString (); */
  78.   NS_IMETHOD ReadString(nsAString & _retval) = 0;
  79.  
  80.   /**
  81.      * Read an opaque byte array from a binary stream.
  82.      */
  83.   /* void readBytes (in PRUint32 aLength, [size_is (aLength), retval] out string aString); */
  84.   NS_IMETHOD ReadBytes(PRUint32 aLength, char **aString) = 0;
  85.  
  86.   /**
  87.      * Read an opaque byte array from a binary stream, storing the results
  88.      * as an array of PRUint8s.
  89.      */
  90.   /* void readByteArray (in PRUint32 aLength, [array, size_is (aLength), retval] out PRUint8 aBytes); */
  91.   NS_IMETHOD ReadByteArray(PRUint32 aLength, PRUint8 **aBytes) = 0;
  92.  
  93. };
  94.  
  95. /* Use this macro when declaring classes that implement this interface. */
  96. #define NS_DECL_NSIBINARYINPUTSTREAM \
  97.   NS_IMETHOD SetInputStream(nsIInputStream *aInputStream); \
  98.   NS_IMETHOD ReadBoolean(PRBool *_retval); \
  99.   NS_IMETHOD Read8(PRUint8 *_retval); \
  100.   NS_IMETHOD Read16(PRUint16 *_retval); \
  101.   NS_IMETHOD Read32(PRUint32 *_retval); \
  102.   NS_IMETHOD Read64(PRUint64 *_retval); \
  103.   NS_IMETHOD ReadFloat(float *_retval); \
  104.   NS_IMETHOD ReadDouble(double *_retval); \
  105.   NS_IMETHOD ReadCString(nsACString & _retval); \
  106.   NS_IMETHOD ReadString(nsAString & _retval); \
  107.   NS_IMETHOD ReadBytes(PRUint32 aLength, char **aString); \
  108.   NS_IMETHOD ReadByteArray(PRUint32 aLength, PRUint8 **aBytes); 
  109.  
  110. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  111. #define NS_FORWARD_NSIBINARYINPUTSTREAM(_to) \
  112.   NS_IMETHOD SetInputStream(nsIInputStream *aInputStream) { return _to SetInputStream(aInputStream); } \
  113.   NS_IMETHOD ReadBoolean(PRBool *_retval) { return _to ReadBoolean(_retval); } \
  114.   NS_IMETHOD Read8(PRUint8 *_retval) { return _to Read8(_retval); } \
  115.   NS_IMETHOD Read16(PRUint16 *_retval) { return _to Read16(_retval); } \
  116.   NS_IMETHOD Read32(PRUint32 *_retval) { return _to Read32(_retval); } \
  117.   NS_IMETHOD Read64(PRUint64 *_retval) { return _to Read64(_retval); } \
  118.   NS_IMETHOD ReadFloat(float *_retval) { return _to ReadFloat(_retval); } \
  119.   NS_IMETHOD ReadDouble(double *_retval) { return _to ReadDouble(_retval); } \
  120.   NS_IMETHOD ReadCString(nsACString & _retval) { return _to ReadCString(_retval); } \
  121.   NS_IMETHOD ReadString(nsAString & _retval) { return _to ReadString(_retval); } \
  122.   NS_IMETHOD ReadBytes(PRUint32 aLength, char **aString) { return _to ReadBytes(aLength, aString); } \
  123.   NS_IMETHOD ReadByteArray(PRUint32 aLength, PRUint8 **aBytes) { return _to ReadByteArray(aLength, aBytes); } 
  124.  
  125. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  126. #define NS_FORWARD_SAFE_NSIBINARYINPUTSTREAM(_to) \
  127.   NS_IMETHOD SetInputStream(nsIInputStream *aInputStream) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetInputStream(aInputStream); } \
  128.   NS_IMETHOD ReadBoolean(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadBoolean(_retval); } \
  129.   NS_IMETHOD Read8(PRUint8 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Read8(_retval); } \
  130.   NS_IMETHOD Read16(PRUint16 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Read16(_retval); } \
  131.   NS_IMETHOD Read32(PRUint32 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Read32(_retval); } \
  132.   NS_IMETHOD Read64(PRUint64 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Read64(_retval); } \
  133.   NS_IMETHOD ReadFloat(float *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadFloat(_retval); } \
  134.   NS_IMETHOD ReadDouble(double *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadDouble(_retval); } \
  135.   NS_IMETHOD ReadCString(nsACString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadCString(_retval); } \
  136.   NS_IMETHOD ReadString(nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadString(_retval); } \
  137.   NS_IMETHOD ReadBytes(PRUint32 aLength, char **aString) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadBytes(aLength, aString); } \
  138.   NS_IMETHOD ReadByteArray(PRUint32 aLength, PRUint8 **aBytes) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadByteArray(aLength, aBytes); } 
  139.  
  140. #if 0
  141. /* Use the code below as a template for the implementation class for this interface. */
  142.  
  143. /* Header file */
  144. class nsBinaryInputStream : public nsIBinaryInputStream
  145. {
  146. public:
  147.   NS_DECL_ISUPPORTS
  148.   NS_DECL_NSIBINARYINPUTSTREAM
  149.  
  150.   nsBinaryInputStream();
  151.  
  152. private:
  153.   ~nsBinaryInputStream();
  154.  
  155. protected:
  156.   /* additional members */
  157. };
  158.  
  159. /* Implementation file */
  160. NS_IMPL_ISUPPORTS1(nsBinaryInputStream, nsIBinaryInputStream)
  161.  
  162. nsBinaryInputStream::nsBinaryInputStream()
  163. {
  164.   /* member initializers and constructor code */
  165. }
  166.  
  167. nsBinaryInputStream::~nsBinaryInputStream()
  168. {
  169.   /* destructor code */
  170. }
  171.  
  172. /* void setInputStream (in nsIInputStream aInputStream); */
  173. NS_IMETHODIMP nsBinaryInputStream::SetInputStream(nsIInputStream *aInputStream)
  174. {
  175.     return NS_ERROR_NOT_IMPLEMENTED;
  176. }
  177.  
  178. /* PRBool readBoolean (); */
  179. NS_IMETHODIMP nsBinaryInputStream::ReadBoolean(PRBool *_retval)
  180. {
  181.     return NS_ERROR_NOT_IMPLEMENTED;
  182. }
  183.  
  184. /* PRUint8 read8 (); */
  185. NS_IMETHODIMP nsBinaryInputStream::Read8(PRUint8 *_retval)
  186. {
  187.     return NS_ERROR_NOT_IMPLEMENTED;
  188. }
  189.  
  190. /* PRUint16 read16 (); */
  191. NS_IMETHODIMP nsBinaryInputStream::Read16(PRUint16 *_retval)
  192. {
  193.     return NS_ERROR_NOT_IMPLEMENTED;
  194. }
  195.  
  196. /* PRUint32 read32 (); */
  197. NS_IMETHODIMP nsBinaryInputStream::Read32(PRUint32 *_retval)
  198. {
  199.     return NS_ERROR_NOT_IMPLEMENTED;
  200. }
  201.  
  202. /* PRUint64 read64 (); */
  203. NS_IMETHODIMP nsBinaryInputStream::Read64(PRUint64 *_retval)
  204. {
  205.     return NS_ERROR_NOT_IMPLEMENTED;
  206. }
  207.  
  208. /* float readFloat (); */
  209. NS_IMETHODIMP nsBinaryInputStream::ReadFloat(float *_retval)
  210. {
  211.     return NS_ERROR_NOT_IMPLEMENTED;
  212. }
  213.  
  214. /* double readDouble (); */
  215. NS_IMETHODIMP nsBinaryInputStream::ReadDouble(double *_retval)
  216. {
  217.     return NS_ERROR_NOT_IMPLEMENTED;
  218. }
  219.  
  220. /* ACString readCString (); */
  221. NS_IMETHODIMP nsBinaryInputStream::ReadCString(nsACString & _retval)
  222. {
  223.     return NS_ERROR_NOT_IMPLEMENTED;
  224. }
  225.  
  226. /* AString readString (); */
  227. NS_IMETHODIMP nsBinaryInputStream::ReadString(nsAString & _retval)
  228. {
  229.     return NS_ERROR_NOT_IMPLEMENTED;
  230. }
  231.  
  232. /* void readBytes (in PRUint32 aLength, [size_is (aLength), retval] out string aString); */
  233. NS_IMETHODIMP nsBinaryInputStream::ReadBytes(PRUint32 aLength, char **aString)
  234. {
  235.     return NS_ERROR_NOT_IMPLEMENTED;
  236. }
  237.  
  238. /* void readByteArray (in PRUint32 aLength, [array, size_is (aLength), retval] out PRUint8 aBytes); */
  239. NS_IMETHODIMP nsBinaryInputStream::ReadByteArray(PRUint32 aLength, PRUint8 **aBytes)
  240. {
  241.     return NS_ERROR_NOT_IMPLEMENTED;
  242. }
  243.  
  244. /* End of implementation class template. */
  245. #endif
  246.  
  247. inline nsresult
  248. NS_ReadOptionalCString(nsIBinaryInputStream* aStream, nsACString& aResult)
  249. {
  250.     PRBool nonnull;
  251.     nsresult rv = aStream->ReadBoolean(&nonnull);
  252.     if (NS_SUCCEEDED(rv)) {
  253.         if (nonnull)
  254.             rv = aStream->ReadCString(aResult);
  255.         else
  256.             aResult.Truncate();
  257.     }
  258.     return rv;
  259. }
  260. inline nsresult
  261. NS_ReadOptionalString(nsIBinaryInputStream* aStream, nsAString& aResult)
  262. {
  263.     PRBool nonnull;
  264.     nsresult rv = aStream->ReadBoolean(&nonnull);
  265.     if (NS_SUCCEEDED(rv)) {
  266.         if (nonnull)
  267.             rv = aStream->ReadString(aResult);
  268.         else
  269.             aResult.Truncate();
  270.     }
  271.     return rv;
  272. }
  273.  
  274. #endif /* __gen_nsIBinaryInputStream_h__ */
  275.